package com.pep.mgmt.service;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Service;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Service("server")
@Slf4j
@Data
public class ServiceHealthStatus implements HealthIndicator {
    
    @Value("${app.version}")
    private String version;

    @Value("${app.name}")
    private String appNameString;

    @Override
    public Health health() {
      Health.Builder builder = Health.up().withDetail("version", this.version).withDetail("name", appNameString);
      return builder.build();
    }

}
